//
//  WYFormBascCell.m
//  CirclePush
//
//  Created by admin on 2018/5/19.
//  Copyright © 2018年 admin. All rights reserved.
//

#import "WYFormBascCell.h"
#import "WYFormCell.h"
#import "WYMediaSubsection.h"
@interface WYFormBascCell()<UITableViewDataSource,UITableViewDelegate>

@end
@implementation WYFormBascCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    [self setUpUI];
}
-(void)setDataArray:(NSArray *)dataArray
{
    _dataArray = dataArray;
    [self.tableView reloadData];
    
    
    
}
-(void)setUpUI
{
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    [self.tableView registerNib:[UINib nibWithNibName:@"WYFormCell" bundle:nil] forCellReuseIdentifier:@"WYFormCell"];
    self.tableView.bounces = NO;
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.dataArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    WYFormCell *cell = [tableView dequeueReusableCellWithIdentifier:@"WYFormCell" forIndexPath:indexPath];
    if (!cell) {
        cell = [[NSBundle mainBundle]loadNibNamed:@"WYFormCell" owner:nil options:nil].firstObject;
    }
    WYMediaSubsection *media = self.dataArray[indexPath.row];
    [cell setMedia:media];
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 70;
}






@end
